home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
ISSUE09
/
CODERS
/
METHDFRM.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-03-20
|
3KB
|
144 lines
unit Methdfrm;
interface
uses
SysUtils,
WinTypes,
WinProcs,
Messages,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
ClipBrd,
StdCtrls,
ExtCtrls,
StrFunc,
ExptTool ;
type
TMethGenFrm = class(TForm)
ClassNameAcquireBtn: TButton;
MethodsAquireBtn: TButton;
MethodsGenBtn: TButton;
PasteBtn: TButton;
OnTopBtn: TButton;
ExitBtn: TButton;
ClassNameEdit: TEdit;
MethodsMemo: TMemo;
SkeletonsMemo: TMemo;
TopBevel: TBevel;
CenterBevel: TBevel;
BottomPanel: TPanel;
procedure FormCreate(Sender: TObject);
procedure ClassNameAcquireBtnClick(Sender: TObject);
procedure MethodsAquireBtnClick(Sender: TObject);
procedure MethodsGenBtnClick(Sender: TObject);
procedure PasteBtnClick(Sender: TObject);
procedure OnTopBtnClick(Sender: TObject);
procedure ExitBtnClick(Sender: TObject);
private
{ Private declarations }
public
OnTop : boolean ;
{ Public declarations }
end;
var
MethGenFrm: TMethGenFrm;
implementation
{$R *.DFM}
procedure TMethGenFrm.FormCreate(Sender: TObject);
begin
OnTop := FALSE ;
OnTopBtn.Caption := '&On Top' ;
end;
procedure TMethGenFrm.ClassNameAcquireBtnClick(Sender: TObject);
begin
SendMessage( FindChild( 'TEditWindow', 'TEditControl' ), WM_COPY, 0, 0 ) ;
ClassNameEdit.Text := Clipboard.AsText ;
end;
procedure TMethGenFrm.MethodsAquireBtnClick(Sender: TObject);
const
BufSize = 2048 ;
var
TheBuf : PChar ;
TheLen : word ;
begin
SendMessage( FindChild( 'TEditWindow', 'TEditControl' ), WM_COPY, 0, 0 ) ;
GetMem( TheBuf, BufSize ) ;
Clipboard.GetTextBuf( TheBuf, BufSize ) ;
MethodsMemo.SetTextBuf( TheBuf ) ;
FreeMem( TheBuf, BufSize ) ;
end;
procedure TMethGenFrm.MethodsGenBtnClick(Sender: TObject);
var
i, index : integer ;
WorkStr : string ;
begin
for i := 0 to MethodsMemo.Lines.Count do
begin
WorkStr := MethodsMemo.Lines[i] ;
if WorkStr <> '' then
begin
WorkStr := LTrim( WorkStr, ' ' ) ;
index := Pos( ' ', WorkStr ) ;
while WorkStr[index] = ' ' do
Inc( index ) ;
Insert( ClassNameEdit.Text + '.', WorkStr, index ) ;
SkeletonsMemo.Lines.Add( WorkStr ) ;
SkeletonsMemo.Lines.Add( 'begin' ) ;
SkeletonsMemo.Lines.Add( '' ) ;
SkeletonsMemo.Lines.Add( 'end ;' ) ;
SkeletonsMemo.Lines.Add( '' ) ;
end ;
end ;
end;
procedure TMethGenFrm.PasteBtnClick(Sender: TObject);
var
TheBuf : PChar ;
TheLen : word ;
begin
TheLen := SkeletonsMemo.GetTextLen ;
GetMem( TheBuf, TheLen ) ;
SkeletonsMemo.GetTextBuf( TheBuf, TheLen ) ;
Clipboard.SetTextBuf( TheBuf ) ;
FreeMem( TheBuf, TheLen ) ;
SendMessage( FindChild( 'TEditWindow', 'TEditControl' ), WM_PASTE, 0, 0 ) ;
end;
procedure TMethGenFrm.OnTopBtnClick(Sender: TObject);
begin
OnTop := not OnTop ;
case OnTop of
TRUE :
begin
NoStayOnTop( Handle ) ;
OnTopBtn.Caption := '&On Top' ;
end ;
FALSE :
begin
StayOnTop( Handle ) ;
OnTopBtn.Caption := '&Off Top' ;
end ;
end ;
end;
procedure TMethGenFrm.ExitBtnClick(Sender: TObject);
begin
Close ;
end;
end.